{include file="layout/layout" /}
<body style="background-color: rgb(255, 255, 255); overflow: auto; cursor: default; -moz-user-select: inherit;">
<div id="append_parent"></div>
<div id="ajaxwaitid"></div>
<div class="page">
    <div class="fixed-bar">
        <div class="item-title">
            <div class="subject">
                <h3>商户管理</h3>
                <h5>网站系统商户提现记录</h5>
            </div>
        </div>
    </div>
    <!-- 操作说明 -->
    <div id="explanation" class="explanation" style="color: rgb(44, 188, 163); background-color: rgb(237, 251, 248); width: 99%; height: 100%;">
        <div id="checkZoom" class="title"><i class="fa fa-lightbulb-o"></i>
            <h4 title="提示相关设置操作时应注意的要点">操作提示</h4>
            <span title="收起提示" id="explanationZoom" style="display: block;"></span>
        </div>
        <ul>
            <li>支付宝，微信在线转账需要申请相关支付接口以及设置管理员支付密码</li>
            <li>审核通过的提现申请会进入待付款列表</li>
        </ul>
    </div>
    <div class="flexigrid">
        <div class="mDiv">
            <div class="ftitle">
                <h3>商户提现记录列表</h3>
                <h5>(共{$count}条记录)</h5>
            </div>
            <div title="刷新数据" class="pReload"><a href=""><i class="fa fa-refresh"></i></a></div>
            <form method="post" action="?act=s">
                <div class="sDiv">
                    <div class="sDiv2" style="margin-right: 10px;">
                        <input size="30" id="start_time" name="s_time" value="" placeholder="开始时间" class="qsbox" type="text"/>
                        <input class="btn" value="按申请时间搜" type="button">
                    </div>
                    <div class="sDiv2" style="margin-right: 10px;border: none;">
                        <select id="status" name="c_status" class="form-control">
                            <option>选择状态</option>
                            <option value="0">待审核</option>
                            <option value="1">审核通过</option>
                            <option value="2">审核失败</option>
                            <option value="3">无效作废</option>
                        </select>
                    </div>
                    <div class="sDiv2" style="margin-right: 10px;">
                        <input size="30" name="sp_name" placeholder="商户名称" class="qsbox" type="text">
                    </div>
                    <div class="sDiv2" style="margin-right: 10px;">
                        <input size="30" placeholder="订单编号" name="c_order" class="qsbox" type="text">
                        <input class="btn" value="搜索" type="submit">
                    </div>
                </div>
            </form>
        </div>
        <div class="hDiv">
            <div class="hDivBox">
                <table cellspacing="0" cellpadding="0">
                    <thead>
                    <tr>
                        <th abbr="article_title" axis="col3" class="" align="center">
                            <div style="text-align: center; width: 80px;" class="">申请ID</div>
                        </th>
                        <th abbr="ac_id" axis="col4" class="" align="center">
                            <div style="text-align: center; width: 80px;" class="">商户ID</div>
                        </th>
                        <th abbr="article_show" axis="col5" class="" align="center">
                            <div style="text-align: center; width: 100px;" class="">商户名称</div>
                        </th>
                        <th abbr="article_time" axis="col6" class="" align="center">
                            <div style="text-align: center; width: 100px;" class="">提现金额</div>
                        </th>
                        <th abbr="article_time" axis="col6" class="" align="center">
                            <div style="text-align: center; width: 150px;" class="">订单编号</div>
                        </th>
                        <th abbr="article_time" axis="col6" class="" align="center">
                            <div style="text-align: center; width: 80px;" class="">状态</div>
                        </th>
                        <th abbr="article_time" axis="col6" class="" align="center">
                            <div style="text-align: center; width: 130px;" class="">申请时间</div>
                        </th>
                        <th abbr="article_time" axis="col6" class="" align="center">
                            <div style="text-align: center; width: 130px;" class="">结束时间</div>
                        </th>
                        <th abbr="article_time" axis="col6" class="" align="center">
                            <div style="text-align: center; width: 150px;" class="">备注</div>
                        </th>
                        <th axis="col1" class="handle" align="center">
                            <div style="text-align: center; width: 100px;">操作</div>
                        </th>
                        <th style="width:100%" axis="col7">
                            <div></div>
                        </th>
                    </tr>
                    </thead>
                </table>
            </div>
        </div>
        <div class="bDiv" style="height: auto;">
            <div id="flexigrid" cellpadding="0" cellspacing="0" border="0">
                <table>
                    <tbody>
                    {foreach $cashes as $k=>$v}
                        <tr>
                            <td class="" align="center">
                                <div style="text-align: center; width: 80px;">{$v.c_id}</div>
                            </td>
                            <td class="" align="center">
                                <div style="text-align: center; width: 80px;">{$v.shop_id}</div>
                            </td>
                            <td class="" align="center">
                                <div style="text-align: center; width: 100px;"><a class="open" href="{:url('Shop/shopDetail',['id'=>$v.shop_id])}" target="blank">{$v.sp_name}<i class="fa fa-external-link " title="新窗口打开"></i>
                                    </a>
                                </div>
                            </td>
                            <td class="" align="center">
                                <div style="text-align: center; width: 100px;">{$v.money/100}<span>元</span></div>
                            </td>
                            <td class="" align="center">
                                <div style="text-align: center; width: 150px;">{$v.c_order}</div>
                            </td>
                            <td class="" align="center">
                                <div style="text-align: center; width: 80px;">
                                    {switch $v.c_status}
                                    {case 1}审核成功{/case}
                                    {case 2}审核失败{/case}
                                    {case 3}无效作废{/case}
                                    {default /}待审核
                                    {/switch}
                                </div>
                            </td>
                            <td class="" align="center">
                                <div style="text-align: center; width: 130px;">{$v.start_time|date='Y-m-d H:i:s'}</div>
                            </td>
                            <td class="" align="center">
                                <div style="text-align: center; width: 130px;">{$v.end_time|date='Y-m-d H:i:s'}</div>
                            </td>
                            <td class="" align="center">
                                <div style="text-align: center; width: 150px;" id="remark{$v.c_id}">{if $v.c_remark}{$v.c_remark}{else/}无{/if}</div>
                            </td>
                            <td class="handle" align="left">
                                <div style="text-align: center; width: 100px; max-width:250px;">
                                    {if $v.c_status==0}
                                    <a class="btn blue" href="javascript:void(0)" id="audit{$v.c_id}" onclick="ajaxAction({$v.c_id},1)" title='审核通过'><i class="fa fa-check-circle"></i>通过</a>
                                    <a class="btn red" href="javascript:void(0)" id="audit2{$v.c_id}" onclick="ajaxAction({$v.c_id},2)" title='审核失败'><i class="fa fa-ban"></i>拒绝</a>
                                    {/if}
                                    <a class="btn blue" href="cashDetail?id={$v.c_id}"><i class="fa fa-search"></i>详情</a>
                                </div>
                            </td>
                            <td class="" style="width: 100%;" align="">
                                <div>&nbsp;</div>
                            </td>
                        </tr>
                    {/foreach}
                    </tbody>
                </table>
            </div>
            <div class="iDiv" style="display: none;"></div>
        </div>
        <!--分页位置-->
        <div><center>{$page|raw}</center></div>
</div>
<script>
    $(document).ready(function(){
        // 表格行点击选中切换
        $('#flexigrid > table>tbody >tr').click(function(){
            $(this).toggleClass('trSelected');
        });
        // 点击刷新数据
        $('.fa-refresh').click(function(){
            location.href = location.href;
        });

        getDate('#start_time');
    　  getDate('#end_time');
    });

    // ajax审核
    function ajaxAction(id,status){
        var remark = '审核成功';
        // 审核失败写备注
        if(status == 2){
            layer.prompt({title: '请填写备注', formType: 2}, function(text, index){
                layer.close(index);
                //传到remark 备注信息
                remark = text;
                ajax(id,status,remark);
            });
        }else if(status == 1){
            ajax(id,status,remark);
        }
    }

    function ajax(id,status,remark){
        $.post('cashAjax',{'c_id':id,'c_status':status,'c_remark':remark},function(res){
            if(res){
                $('#audit'+id).remove();
                $('#audit2'+id).remove();
                $('#remark'+id).html(remark);
                layer.alert('操作成功',{icon:1,closeBtn:0});
            }else{
                layer.alert('操作失败',{icon:2,time:3000});
            }
        })
    }
</script>
</body>
</html>